3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
This section describes the routines you might need to define when using the routines in the QuickDraw 3D Pointing Device Manager.
You can define a function that QuickDraw 3D calls to get a channel of a controller.
typedef TQ3Status (*TQ3ChannelGetMethod) (
TQ3ControllerRef controllerRef,
unsigned long channel,
void *data,
unsigned long *dataSize);
Your TQ3ChannelGetMethod function should return, in the buffer pointed to by the data parameter, the current value of the controller channel specified by the controllerRef and channel parameters. Your function should also return, in the dataSize parameter, the size of that data. QuickDraw 3D allocates memory for the data buffer before it calls your function and deallocates the memory after your function has returned. The maximum number of bytes that the data buffer can hold is defined by a constant:
#define kQ3ControllerSetChannelMaxDataSize 256
You need to define a channel-getting method only if you are writing a device driver for a controller. You can, however, call Q3Controller_GetChannel at any time to invoke a controller's channel-getting method.
Your channel-getting method should return kQ3Success if it is able to return the requested information and kQ3Failure otherwise.
See the description of Q3Controller_GetChannel on [link] for information on getting a controller's channels.
You can define a function that QuickDraw 3D calls to set a channel of a controller.
typedef TQ3Status (*TQ3ChannelSetMethod) (
TQ3ControllerRef controllerRef,
unsigned long channel,
const void *data,
unsigned long dataSize);
Your TQ3ChannelSetMethod function should set the controller channel specified by the controllerRef and channel parameters to the value specified by the data parameter. The dataSize parameter specifies the number of bytes in the data buffer. QuickDraw 3D allocates memory for the data buffer before it calls your function and deallocates the memory after your function has returned. The maximum number of bytes that the data buffer can hold is defined by a constant:
#define kQ3ControllerSetChannelMaxDataSize 256
You need to define a channel-setting method only if you are writing a device driver for a controller. You can, however, call Q3Controller_SetChannel at any time to invoke a controller's channel-setting method.
Your channel-setting method should return kQ3Success if it is able to set the specified channel to the specified value and kQ3Failure otherwise.
See the description of Q3Controller_SetChannel on [link] for information on setting a controller's channels.
You can define a tracker notify function that QuickDraw 3D calls when a controller associated with a tracker has new data.
typedef TQ3Status (*TQ3TrackerNotifyFunc) (
TQ3TrackerObject trackerObject,
TQ3ControllerRef controllerRef);
Your TQ3TrackerNotifyFunc function is called whenever any controller associated with a tracker has new data to be processed and the data meets or exceeds the current position and orientation thresholds for the tracker. The affected controller and tracker are passed in the controllerRef and trackerObject parameters. Your tracker notify function might, for example, schedule your application to awaken and redraw the scene.
Your tracker notify function might be called at interrupt time, but it is never called reentrantly.
Your tracker notify function should return kQ3Success if it is successful and kQ3Failure otherwise.
See the description of Q3Tracker_New [link] for information on setting the notify function of a tracker.
Previous | QD3D Book | Overview | Chapter Contents | Next |